package org.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.example.entity.Business;
import org.example.service.BusinessService;

import java.util.List;

@RestController
@RequestMapping("/business")
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    // 根据 orderTypeId 查询商家列表
    @GetMapping("/listBusinessByOrderTypeId")
    public List<Business> listBusinessByOrderTypeId(@RequestParam("orderTypeId") Integer orderTypeId) {
        return businessService.listBusinessByOrderTypeId(orderTypeId);
    }

    // 根据 businessId 查询商家信息
    @GetMapping("/getBusinessById")
    public Business getBusinessById(@RequestParam("businessId") Integer businessId) {
        return businessService.getBusinessById(businessId);
    }
}